home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Clinical Endocrinology
/
Clinical Endocrinology.iso
/
pc
/
00000000
/
bookmark.dir
/
00001_Script_1
next >
Wrap
Text File
|
1995-11-20
|
7KB
|
285 lines
on init
global installedFolderpath, gReadBkMarks, marksList, refList
global bookmarkChoice --, gBookFlag
--set gBookFlag = TRUE
set marksList = []
set the keyDownScript = "doAddReturn"
set bookmarkChoice = 1
put fileIO(mNew, "read", installedFolderpath & "Bookmark.DAT") into gReadBkMarks
if not objectp(gReadBkMarks) then
alert "Sorry. Can't find bookmarks data."
else
readBookmarks -- reads the txt file and puts it into a list
makeLinkLists -- splits this list into a reference list and link list
displayRefs -- shows the refList, item by item, in the display field
if count(marksList) > 0 then
hilite line bookmarkChoice of field "Display Field"
else
set bookmarkChoice = 0
end if
end if
end init
-----------------------------------------------------------------------------------
on readBookmarks
global gReadBkMarks, marksList
put gReadBkMarks(mReadFile) into myText
if myText <> "" then
put the number of lines in myText into theLines
repeat with i = 1 to theLines
put line i of myText into myItem
add marksList, myItem
end repeat
end if
gReadBkMarks(mDispose)
end readBookmarks
------------------------------------------------------------------
-- This handler takes marksList made from the txt file
-- and splits it, using two functions, into two lists
--
on makeLinkLists
global marksList, refList, linkList, frameList
set refList = []
set frameList = []
set linkList = []
repeat with i = 1 to count(marksList)
put getAt(marksList, i) into listString
put stripRef(listString) into refString
add(refList, refString)
put stripFrameRef(listString) into frameRefString
add(frameList, frameRefString)
put stripPath(listString) into pathString
add(linkList, pathString)
end repeat
end makeLinkLists
-----------------------------------------------------
-- This is a function!!
-- To use this, use the syntax below
-- put stripStart( <put a string in here> ) into newString
-- where newstring is the stripped word resulting
-- from this function
-- StripEnd uses the same syntax.
on stripRef listString
set the itemDelimiter to "*"
return item 1 of listString
end stripRef
-----------------------------------------------------
on stripFrameRef listString
set the itemDelimiter to "*"
return item 2 of listString
end stripFrameRef
-----------------------------------------------------
on stripPath listString
set the itemDelimiter to "*"
return item 3 of listString
end stripPath
-----------------------------------------------------
on displayRefs
global refList
put "" into theText
put count(refList) into theItems
repeat with i = 1 to theItems
put getAt(refList, i) into theRef
if i = 1 then
put theRef after theText
else
put RETURN & theRef after theText
end if
end repeat
put theText into field "Display Field"
end displayRefs
-----------------------------------------------------
on addBookmark
global refList, linkList, marksList, parentPath, bookmarkChoice
global frameList, gBookFrame
put the text of field "User Field" into newRef
if newRef = "" then
alert "Please name the bookmark first."
else
add refList, newRef
getParentPath
--insert routine for getting the frame
add frameList, gBookFrame
add linkList, parentPath
add marksList, newRef & "*" & gBookFrame & "*" & parentPath
writeBookMarks
displayRefs
set bookmarkChoice = count(marksList)
hilite line bookmarkChoice of field "Display Field"
end if
end addBookmark
-------------------------------------------------------------
on deleteBookmark
global refList, linkList, marksList, parentPath, bookmarkChoice
global frameList
if count(marksList) > 0 then
deleteAt marksList, bookmarkChoice
makeLinkLists
writeBookMarks
displayRefs
if count(marksList) > bookmarkChoice then
set bookmarkChoice = count(marksList)
hilite line bookMarkChoice of field "Display Field"
else
set bookmarkChoice = count(marksList)
if bookmarkChoice <> 0 then hilite line bookMarkChoice of field "Display Field"
end if
else
alert "Choose a Bookmark to delete."
end if
end deleteBookmark
-------------------------------------------------------------
on getParentPath
global parentPath, gBookFrame
tell the stage
global parentPath, gBookFrame
put the pathname & the movieName into parentPath
put the frame into gBookFrame
end tell
end getParentPath
-------------------------------------------------------------
on writeBookMarks
global refList, linkList, marksList, gWriteBkMarks, installedFolderpath
if count(refList) <> count(linkList) then
alert "Missing some data! Try opening Bookmark.DAT" & RETURN &¼
"and erasing all entries! Start from scratch."
end if
put "" into newData
repeat with i = 1 to count(marksList)
if i = 1 then
put getAt(marksList, i) after newData
else
put RETURN & getAt(marksList, i) after newData
end if
end repeat
put fileIO(mNew, "write", installedFolderpath & "Bookmark.DAT") into gWriteBkMarks
if not objectP(gWriteBkMarks) then
alert "Sorry can't find bookmark data."
else
gWriteBkMarks(mWriteString, newData)
gWriteBkMarks(mDispose)
end if
end writeBookMarks
-----------------------------------------------------
on chooseLine
global bookmarkChoice
put the mouseLine into bookmarkChoice
if bookmarkChoice > 0 then
hilite line bookmarkChoice of field "Display Field"
end if
end chooseLine
-----------------------------------------------------
on goToBookMarkOld
global bookmarkChoice, linkList, frameList
if bookmarkChoice > count(linkList) then
alert "Please, choose a bookmark."
else if count(linkList) < 1 then
alert "There are no bookmarks. Bookmarks must be added first."
else
put getAt(linkList, bookmarkChoice) into newPath
put getAt(frameList, bookmarkChoice) into newFrame
tell the stage
if value(newFrame) > 1 then
go frame newFrame of movie newPath
init
calcSlider
put "newFrame =" & newFrame
else
go movie newPath
end if
end tell
end if
end goToBookMarkOld
------------------------------------------------------
on doAddReturn
if the key = RETURN then
addBookmark
dontPassEvent
end if
end doAddReturn
-----------------------------------------------------
on goToBookMark
global bookmarkChoice, linkList, frameList
if bookmarkChoice > count(linkList) then
alert "Please, choose a bookmark."
else if count(linkList) < 1 then
alert "There are no bookmarks. Bookmarks must be added first."
else
put getAt(linkList, bookmarkChoice) into newPath
put getAt(frameList, bookmarkChoice) into newFrame
tell the stage
go movie newPath
end tell
end if
end goToBookMark